package whisper.api.gateway.frame.auth.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import whisper.api.gateway.frame.auth.domain.Permission;
import whisper.api.gateway.frame.auth.domain.Role;
import whisper.api.gateway.frame.auth.repository.PermissionRepository;

import java.util.List;

/**
 * Created by JT on 2017/9/25.
 */
@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionRepository permissionRepository;

    @Override
    public void insertPermission(Permission permission) {
        permissionRepository.insertPermission(permission);
    }

    @Override
    public List<Role> findRolesByPermissionUrl(String url) {
        return permissionRepository.findRolesByPermissioinUrl(url);
    }

    @Override
    public List<Role> findRolesByPermissionUrlAndType(String url, String type) {
        return permissionRepository.findRolesByPermissionUrlAndType(url, type);
    }
}
